/*
 * @Des: 
 * @Author: jin_yc
 * @Date: 2019-11-12 15:19:21
 * @LastEditor: jin_yc
 * @LastEditTime: 2019-12-10 10:32:07
 */
//   @Author: zeng_ze
//   @date: 2019-11-09
//   @Description: 系统管理模块接口
import request from '@/utils/request'

export function getModelList(modelKey, modelName, page, size) {
  return request({
    method: 'get',
    url: '/sys-bpm/models',
    params: {
      modelKey: modelKey,
      modelName: modelName,
      page: page,
      size: size
    }
  })
}

export function formRelsList(data) {
  return request({
    method: 'get',
    url: '/sys-bpm/formRels',
    params: {
      formCategory: data.formCategory || '',
      formKey: data.formKey || '',
      formName: data.formName || '',
      modelKey: data.modelKey || '',
      page: data.page || '',
      size: data.size || ''
    }
  })
}
/**
 * @description: 表单流程管理 新建/修改 
 * @param {data} 表单数据
 * @param {type} 参数put为修改post为新增，默认为新增
 */
export function formRels(data, type) {
  return request({
    method: type || 'post',
    url: '/sys-bpm/formRel',
    data: data,
    transformRequest: [
      data => {
        return data
      }
    ],
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function deleteFormRels(id) {
  return request({
    method: 'detele',
    url: '/sys-bpm/formRel/' + id
  })
}

/**
 * @description: 流程部署
 * @param {modelId} 流程模型ID 参数二选一
 * @param {modelKey} 流程模型Key 参数二选一
 */
export function modelDeployment(modelId, modelKey) {
  return request({
    method: 'post',
    url: '/sys-bpm/model/deployment',
    params: {
      modelId: modelId || '',
      modelkey: modelKey || ''
    }
  })
}